#ifndef BERNOULLINODE_H
#define BERNOULLINODE_H

#include "Node.h"

#include <QVector>
#include <QMap>

class BernoulliNode : public Node
{
public:
    BernoulliNode(double sampleValue = 0.0, bool isObserved = false);

    BernoulliNode(Node* parent, double sampleValue = 0.0, bool isObserved = false);

    BernoulliNode(const BernoulliNode& other);

    ~BernoulliNode();

    void addParent(Node* parent);

    void addTableEntry(QString parentValues, Node * probabilityNode);

    void addTableEntry(QString parentValues, double probability);

    bool isInProbabilityTable(QString parentValues);

    double getProbability(QString parentValues);

    double logLikelihood(double x);

    double sample();

private:
    QVector<Node*> nodeParents;
    QMap<QString, double> probabilityTable;
    QMap<QString, Node*> nodalProbabilityTable;
};

#endif // BERNOULLINODE_H
